package com.zhangshuo.common.rabbitmq;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2017/6/8 0008.
 */
//@Component
public class Sender {

    //用来操作消息队列
    @Autowired
    private  AmqpTemplate rabbitTemplate;
    //用来声明exchange queue binding 的关系
    @Autowired
    private  AmqpAdmin rabbitAdmin;

    private  String default_exchange = "my.test";
    private  String default_routingKey = "test";


    public  void send(Object content){
        rabbitTemplate.convertAndSend(default_exchange,default_routingKey,content);
    }

    public  void send(String exchange, String routingKey, Object content){
        rabbitTemplate.convertAndSend(exchange,routingKey,content);
    }

}
